{% extends 'TopxiaWebBundle:My:layout.html.twig' %}

{% block title %}{{'我的课程'|trans}} - {{ parent() }}{% endblock %}

{% set side_nav = 'notes' %}
{% set script_controller = 'my/notebook-show' %}

{% block main %}
<style>
.notebook-body img{
  width: 100%;
}
</style>
<div class="panel panel-default panel-col">
  <div class="panel-heading">{{'我的笔记'|trans}}</div>
  <div class="panel-body">
    <div class="notebook" id="notebook">
      <div class="notebook-heading">
        <a class="btn btn-default btn-sm pull-right notebook-back-btn" href="{{ path('my_notebooks') }}" >{{'返回'|trans}}</a>
        <img class="notebook-icon" src="{{ filepath(course.largePicture, 'course.png') }}" />
        {{'《'|trans}}{{ course.title }}{{'》'|trans}}{{'的笔记'|trans}}
      </div>
      <div class="notebook-body">
        {% for note in notes %}
          {% set lesson = lessons[note.lessonId]|default(null) %}
          <div class="notebook-note notebook-note-collapsed">
            <div class="notebook-note-heading">
              {% if lesson %}
                <a href="{{ path('course_learn', {id:note.courseId}) }}#lesson/{{ lesson.id }}" target="_blank">课时{{ lesson.number }}：{{ lesson.title }}</a>
              {% else %}
                <span>{{'该课时已删除'|trans}}</span>
              {% endif %}
              <span class="pull-right notebook-note-length">{{'共'|trans}}{{ note.length }}{{'字'|trans}}</span>
            </div>
            <div class="notebook-note-summary">{{ note.content|plain_text(97) }}</div>
            <div class="notebook-note-body">
                {{ note.content|raw }}

              <div class="notebook-note-actions clearfix">
                <a href="javascript:" data-url="{{ path('my_note_delete', {id:note.id}) }}" class="pull-right notebook-note-delete" title="{{'删除笔记'|trans}}"><span class="glyphicon glyphicon-trash"></span></a>
              </div>
              <div class="notebook-note-collapse-bar"><span class="glyphicon glyphicon-chevron-up"></span></div>
            </div>
          </div>
        {% endfor %}
      </div>
    </div>
  </div>
</div>
{% endblock %}